//
//  XHRPayAttentionViewController.m
//  快医
//
//  Created by 胥鸿儒 on 16/7/6.
//
//

#import "XHRPayAttentionViewController.h"
#import "WWAttentionDoctorTableViewCell.h"
#import "XHRNetworkingToolManager.h"
#import "WWPayAttentionModel.h"
#import "WWDoctorHeaderView.h"
#import <MJExtension.h>
#import "WWDoctorDetailViewController.h"

@interface XHRPayAttentionViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)NSArray <WWPayAttentionModel*>*attentionArray;

@end

@implementation XHRPayAttentionViewController

#pragma mark
#pragma mark - 懒加载,异步刷新
- (void)setAttentionArray:(NSArray<WWPayAttentionModel *> *)attentionArray{
    _attentionArray = attentionArray;
   
    //刷新
    [self.tableView reloadData];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = XHRColorWithRGB(241, 242, 242);
       //注册cell
    [self.tableView registerClass:[WWAttentionDoctorTableViewCell class] forCellReuseIdentifier:@"cell"];
    self.tableView.rowHeight = 110;
   
    //MARK: - 传值
    [WWPayAttentionModel attentionListsuccess:^(NSArray<WWPayAttentionModel *> *tempArray) {
        
        self.attentionArray = tempArray;
                
    } error:^{
        
    }];


    
}
#pragma mark
#pragma mark - 代理方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 5;
}

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    //MARK: - 缓存找
    WWAttentionDoctorTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    
    //MARK: - 模型
    WWPayAttentionModel * model = self.attentionArray[indexPath.row];
    cell.model = model;
           return cell;

    
}

#pragma mark
#pragma mark - 点击跳转
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
        WWDoctorDetailViewController * doctorDetailVc = [[WWDoctorDetailViewController alloc]init];
    
       doctorDetailVc.wwViewModel = self.attentionArray[indexPath.row]  ;
    
    [self.navigationController pushViewController:doctorDetailVc animated:YES];
    
}


@end
